LazyLoad.js([window.ControllerSite + "js/jquery.min.js", window.ControllerSite + "js/mbiyao.js", window.ControllerSite + "js/jquery.lazyload.min.js", window.ControllerSite + "js/by.common.js"], function() {
    function e(e, i) {
        switch (i) {
            case "1":
                t = window.ControllerSite + "/products/" + e.suId + ".html";
                break;
            case "2":
                t = e.url;
                break;
            case "3":
                t = window.ControllerSite + "/classify/supplierHome?supplierId=" + e.supplierID + "&title=" + encodeURIComponent(e.title);
                break;
            case "4":
                t = window.ControllerSite + "/classify/categoryList?categoryId=" + e.categoryID + "&title=" + encodeURIComponent(e.title);
                break;
            case "5":
                t = window.ControllerSite + "/classify/marketList?type=1&title=" + encodeURIComponent(e.title);
                break;
            case "6":
                t = window.ControllerSite + "/classify/marketList?type=2&title=" + encodeURIComponent(e.title);
                break;
            case "7":
                t = window.ControllerSite + "/classify/newproductList?title=" + encodeURIComponent(e.title) } }

    function i() {
        var e = { pageIndex: g, pageSize: u };
        $.ajax({ type: "post", url: window.ControllerSite + "/getHomeModuleInfo", dataType: "json", contentType: "application/x-www-form-urlencoded;charset=utf-8", data: e, success: function(e) {
                if (1 == e.success) {
                    var i = e.data.pageCount;
                    i > g ? g++ : $(".m_addmore_btn") && $(".m_addmore_btn").remove();
                    var a = e.data.modules;
                    o(a) } else OurBox.alert("网络连接失败，请稍候重试", function() {}, { width: "120" }) }, error: function() { OurBox.alert("网络连接失败，请稍候重试", function() {}, { width: "120" }) } }) }

    function o(i) {
        if (i.length > 0)
            for (var o = 0; o < i.length; o++) {
                var a = i[o].moduleType,
                    n = i[o].moduleInfo.moduleItems,
                    s = "";
                switch (a) {
                    case "1":
                        for (var l = "", d = "", c = 0; c < n.length; c++) {
                            var r = n[c].clickType;
                            e(n[c].ext, r), d += '<a href="' + t + '" class="item"><img src="' + n[c].image + '" /></a>' }
                        i[o].moduleInfo.moduleTitle && (s = '<h2 class="h_module_h2">' + i[o].moduleInfo.moduleTitle + "</h2>"), l = $('<div class="boxShadow h_module_pd mg_t10">' + s + '<div class="h_module_show"><div class="h_module_img_list">' + d + "</div></div></div>"), l.find(".item img").on("load", function(e, i) {
                            return function() { e.find(".h_module_img_list").css({ width: $(".item").outerWidth(!0) * e.find(".item").length + Math.ceil(parseFloat($(".h_module_show").css("padding-left"))) }), new IScroll(i, { eventPassthrough: !0, scrollX: !0, scrollY: !1, preventDefault: !1 }) } }(l, l.find(".h_module_show")[0])), $("#min_hdiv").append(l);
                        var m = .92 * (.975 * $("body").width() - parseInt($(".h_module_show a").css("margin-right")));
                        $(".h_module_show .item").css({ width: m });
                        break;
                    case "2":
                        for (var l = "", d = "", c = 0; c < n.length; c++) {
                            var r = n[c].clickType;
                            e(n[c].ext, r), d += 0 == c ? '<a href="' + t + '" class="indexCategoryItem1 bbox"><img class="indexpic" src="' + window.ControllerSite + 'https://static.biyao.com/m/img/base/zwpic1.png" data-original="' + n[c].image + '" /></a>' : 1 == c ? '<a href="' + t + '" class="indexCategoryItem2 bbox"><img class="indexpic" src="' + window.ControllerSite + 'https://static.biyao.com/m/img/base/zwpic1.png" data-original="' + n[c].image + '" /></a>' : '<a href="' + t + '" class="indexCategoryItem3 bbox"><img class="indexpic" src="' + window.ControllerSite + 'https://static.biyao.com/m/img/base/zwpic1.png" data-original="' + n[c].image + '" /></a>' }
                        i[o].moduleInfo.moduleTitle && (s = '<h2 class="h_module_h2">' + i[o].moduleInfo.moduleTitle + "</h2>"), l = '<div class="boxShadow h_module_pd mg_t10">' + s + '<div class="indexCategoryArea"><div class="indexCategoryItemWrap">' + d + "</div></div></div>", $("#min_hdiv").append(l), $(".indexpic").lazyload({ threshold: 50 });
                        break;
                    case "3":
                        // for (var l = "", d = "", c = 0; c < n.length; c++) {
                        //     var r = n[c].clickType;
                        //     e(n[c].ext, r), d += '<a class="commodity_link" href="' + t + '"><img class="indexpic" src="' + window.ControllerSite + 'https://static.biyao.com/m/img/base/zwpic1.png" data-original="' + n[c].image + '" alt=""/><div class="tit inaline">' + n[c].ext.itemName + '</div><div class="price">￥' + n[c].ext.itemPrice + "</div></a>" }
                        var r = i[o].moduleInfo.clickType;
                        e(i[o].moduleInfo, r), i[o].moduleInfo.moduleTitle && (s = 
                            '<a href="' + t + '" class="h_module_h3"><span class="txt">' + i[o].moduleInfo.moduleTitle + '</span></a>'), l = '<div class="boxShadow h_module_pd mg_t10">' + s + '<a href="' + t + '" class="h_bigimg_box"><img class="indexpic" src="' + window.ControllerSite + 'https://static.biyao.com/m/img/base/zwpic1.png" data-original="' + i[o].moduleInfo.moduleImage + '"  alt=""/>' + '<div class="h_sup_wrapper"><div class="h_sup_left"><div class="name">' + i[o].moduleInfo.name + '</div><div class="brand">' + i[o].moduleInfo.brand + '</div><div><div class="h_sup_right"><div>' + i[o].moduleInfo.price + '元起</div></div></div>' + '</a>' + "</div>", $("#min_hdiv").append(l), $(".indexpic").lazyload({ threshold: 50 }) } } }
    if (1 != isinapp && $(".m_mine,.m_shopcar,.m_bfsq").removeClass("none"), $(".staticpage").length > 0 && void 0 != getCookie("uid") && void 0 != getCookie("userinfo")) {
        var a = getCookie("userinfo").split(",");
        $(".m_f_top").html('<span class="f_l pad_5 col_666 escp m_nickname">' + a[0] + '</span><span class="f_l col_666 pad_m_5">&nbsp;丨&nbsp;</span><a class="touri f_l pad_5 col_666" touri="/account/logout">退出</a><a class="f_r col_666 pointer pad_5 totop"><span>回顶部</span></a><span class="f_r col_666 pad_m_5">&nbsp;丨&nbsp;</span><a class="f_r col_666 pointer pad_5 touri" touri="http://m.biyao.com/supplier/mini?url_param=ljby"><span>关于必要</span></a>') }
    0 == MBase.cookie.gettfCookie("appdown") && 1 != isinapp && "milife" != getCookie("channel") && "bdwm" != getCookie("channel") ? void 0 == getCookie("uid") && getCookie("channel") && getCookie("channel").length >= 35 || ($("#m_wap").css("min-height", $(window).height() - 380 + "px"), $("body").css("padding-bottom", "60px"),  $(".toapp").bind("click", function() { gotodown() }), $(".toappclose").bind("click", function() {
        return $("#m_wap").css("min-height", $(window).height() - 320 + "px"), $("body").css("padding-bottom", "0px"), $(this).parent().remove(), MBase.cookie.settfCookie("appdown"), !1 })) : $("#m_wap").css("min-height", $(window).height() - 320 + "px"), $("#m_wap").css("min-height", $(window).height() - 280 + "px");
    var t = "",
        n = HomePageJson.banners;
    if (n.length > 0) {
        var s = "",
            l = $(".slidermain"),
            d = l.find("ul");
        d.css({ height: d.find("img").height() + "px" });
        for (var c = 0; c < n.length; c++) {
            var r = n[c].clickType;
            e(n[c].ext, r), s = s + '<li><a href="' + t + '"><img  class="lb" src="' + n[c].image + '"/></a></li>' }
        n.length > 1 ? (d.html(s).append(d.children()[0].outerHTML).prepend(d.children()[0].outerHTML), LazyLoad.js([window.ControllerSite + "js/ourslider.js"], function() { l.ourSlider({ scurpage: 2, autoplay: !0, playspeed: 4e3, movespeed: 3, callbacks: function() {} }) })) : d.html(s) } else $(".m_slider").remove();
    if (HomePageJson.article && HomePageJson.article.ext) { console.log(HomePageJson.article.ext.url), $(".h_article_box").removeClass("none_im").attr("href", HomePageJson.article.ext.url);
        var m = "<img src='" + HomePageJson.article.iconUrl + "' class='h_article_pic'>" + HomePageJson.article.ext.title;
        $(".h_article_tit").html(m) }
    var p = HomePageJson.modules;
    o(p);
    var h = HomePageJson.pageCount;
    h > 1 && $("#min_hdiv").after('<div align="center" class="m_addmore_btn"><span>加载更多...</span></div>');
    var g = 2,
        u = 10;
    $(".m_addmore_btn").on("click", function() { i() }), MBase.active.addactive(), MBase.active.addotheract($(".logopic"), 1), MBase.active.addotheract($(".m_cqhd .ad_href img")), $("body").append('<span class="alrloadind"></span>') });
